package com.tpc.control.jpa;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Vector;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * CommonData entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "common_data", catalog = "production_control")
public class CommonData implements java.io.Serializable {

	// Fields

	private CommonDataId id;
	private SaleData saleData;
	private Plant plant;
	private String customer;
	private String customerName;
	private String customerPoNo;
	private String distrChannel;
	private Date saleCreated;
	private Date preDue;
	private Date dueDate;
	private String pirNo;
	private Date pirDueDate;
	private String division;
	private String material;
	private String designNoFg;
	private String dyelotLab;
	private Double quantity;
	private String uom;
	private Date prodCreateDate;
	private Date planStartDate;
	private Date startDate;
	private Double finishGoods;
	private Date lastPostingDate;
	private Date planFinishDate;
	private String poNo;
	private String designNoGreige;
	private Date greigeDueDate;
	private String planGreige;
	private Date actualGreige;
	private String greigeRemark;
	private Date startDye;
	private String dyeRemark;
	private Date submitDate;
	private String dueSubmitDate;
	private String status;
	private Date planDueDate;
	private String currentOperation;
	private String userStatus;
	private Double totProduceQty;
	private String colorStatus;
	private Date confirmToPlan;
	private Date confirmToSale;
	private String confirmType;
	private String userStatusCode;
	private Date basicStartDate;
	private Date basicFinishDate;
	private String overdueStatus;
	private String reserveDyeRemark;
	private Set<PlanGreige> planGreiges = new HashSet<PlanGreige>(0);
	private Set<RoutingData> routingDatas = new HashSet<RoutingData>(0);
	private Set<ReserveItemGreige> reserveItemGreiges = new HashSet<ReserveItemGreige>(
			0);

	// Constructors

	/** default constructor */
	public CommonData() {
	}

	/** minimal constructor */
	public CommonData(CommonDataId id, Plant plant, String customer,
			String customerName, String customerPoNo, String distrChannel,
			String pirNo, String division, String material, String designNoFg,
			String dyelotLab, Double quantity, String uom, Double finishGoods,
			String poNo, String designNoGreige, String planGreige,
			String greigeRemark, String dyeRemark, String dueSubmitDate,
			String status, String currentOperation, String userStatus,
			Double totProduceQty, String colorStatus, String userStatusCode,
			String overdueStatus) {
		this.id = id;
		this.plant = plant;
		this.customer = customer;
		this.customerName = customerName;
		this.customerPoNo = customerPoNo;
		this.distrChannel = distrChannel;
		this.pirNo = pirNo;
		this.division = division;
		this.material = material;
		this.designNoFg = designNoFg;
		this.dyelotLab = dyelotLab;
		this.quantity = quantity;
		this.uom = uom;
		this.finishGoods = finishGoods;
		this.poNo = poNo;
		this.designNoGreige = designNoGreige;
		this.planGreige = planGreige;
		this.greigeRemark = greigeRemark;
		this.dyeRemark = dyeRemark;
		this.dueSubmitDate = dueSubmitDate;
		this.status = status;
		this.currentOperation = currentOperation;
		this.userStatus = userStatus;
		this.totProduceQty = totProduceQty;
		this.colorStatus = colorStatus;
		this.userStatusCode = userStatusCode;
		this.overdueStatus = overdueStatus;
	}

	/** full constructor */
	public CommonData(CommonDataId id, SaleData saleData, Plant plant,
			String customer, String customerName, String customerPoNo,
			String distrChannel, Date saleCreated, Date preDue, Date dueDate,
			String pirNo, Date pirDueDate, String division, String material,
			String designNoFg, String dyelotLab, Double quantity, String uom,
			Date prodCreateDate, Date planStartDate, Date startDate,
			Double finishGoods, Date lastPostingDate, Date planFinishDate,
			String poNo, String designNoGreige, Date greigeDueDate,
			String planGreige, Date actualGreige, String greigeRemark,
			Date startDye, String dyeRemark, Date submitDate,
			String dueSubmitDate, String status, Date planDueDate,
			String currentOperation, String userStatus, Double totProduceQty,
			String colorStatus, Date confirmToPlan, Date confirmToSale,
			String confirmType, String userStatusCode, Date basicStartDate,
			Date basicFinishDate, String overdueStatus,
			String reserveDyeRemark, Set<PlanGreige> planGreiges,
			Set<RoutingData> routingDatas,
			Set<ReserveItemGreige> reserveItemGreiges) {
		this.id = id;
		this.saleData = saleData;
		this.plant = plant;
		this.customer = customer;
		this.customerName = customerName;
		this.customerPoNo = customerPoNo;
		this.distrChannel = distrChannel;
		this.saleCreated = saleCreated;
		this.preDue = preDue;
		this.dueDate = dueDate;
		this.pirNo = pirNo;
		this.pirDueDate = pirDueDate;
		this.division = division;
		this.material = material;
		this.designNoFg = designNoFg;
		this.dyelotLab = dyelotLab;
		this.quantity = quantity;
		this.uom = uom;
		this.prodCreateDate = prodCreateDate;
		this.planStartDate = planStartDate;
		this.startDate = startDate;
		this.finishGoods = finishGoods;
		this.lastPostingDate = lastPostingDate;
		this.planFinishDate = planFinishDate;
		this.poNo = poNo;
		this.designNoGreige = designNoGreige;
		this.greigeDueDate = greigeDueDate;
		this.planGreige = planGreige;
		this.actualGreige = actualGreige;
		this.greigeRemark = greigeRemark;
		this.startDye = startDye;
		this.dyeRemark = dyeRemark;
		this.submitDate = submitDate;
		this.dueSubmitDate = dueSubmitDate;
		this.status = status;
		this.planDueDate = planDueDate;
		this.currentOperation = currentOperation;
		this.userStatus = userStatus;
		this.totProduceQty = totProduceQty;
		this.colorStatus = colorStatus;
		this.confirmToPlan = confirmToPlan;
		this.confirmToSale = confirmToSale;
		this.confirmType = confirmType;
		this.userStatusCode = userStatusCode;
		this.basicStartDate = basicStartDate;
		this.basicFinishDate = basicFinishDate;
		this.overdueStatus = overdueStatus;
		this.reserveDyeRemark = reserveDyeRemark;
		this.planGreiges = planGreiges;
		this.routingDatas = routingDatas;
		this.reserveItemGreiges = reserveItemGreiges;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "productionNo", column = @Column(name = "production_no", nullable = false, length = 12)),
			@AttributeOverride(name = "seq", column = @Column(name = "seq", nullable = false, length = 1)) })
	public CommonDataId getId() {
		return this.id;
	}

	public void setId(CommonDataId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns( {
			@JoinColumn(name = "sale_order", referencedColumnName = "sale_order"),
			@JoinColumn(name = "sale_item", referencedColumnName = "sale_item") })
	public SaleData getSaleData() {
		return this.saleData;
	}

	public void setSaleData(SaleData saleData) {
		this.saleData = saleData;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "plant", nullable = false)
	public Plant getPlant() {
		return this.plant;
	}

	public void setPlant(Plant plant) {
		this.plant = plant;
	}

	@Column(name = "customer", nullable = false, length = 10)
	public String getCustomer() {
		return this.customer;
	}

	public void setCustomer(String customer) {
		this.customer = customer;
	}

	@Column(name = "customer_name", nullable = false, length = 40)
	public String getCustomerName() {
		return this.customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	@Column(name = "customer_po_no", nullable = false, length = 35)
	public String getCustomerPoNo() {
		return this.customerPoNo;
	}

	public void setCustomerPoNo(String customerPoNo) {
		this.customerPoNo = customerPoNo;
	}

	@Column(name = "distr_channel", nullable = false, length = 2)
	public String getDistrChannel() {
		return this.distrChannel;
	}

	public void setDistrChannel(String distrChannel) {
		this.distrChannel = distrChannel;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "sale_created", length = 10)
	public Date getSaleCreated() {
		return this.saleCreated;
	}

	public void setSaleCreated(Date saleCreated) {
		this.saleCreated = saleCreated;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "pre_due", length = 10)
	public Date getPreDue() {
		return this.preDue;
	}

	public void setPreDue(Date preDue) {
		this.preDue = preDue;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "due_date", length = 10)
	public Date getDueDate() {
		return this.dueDate;
	}

	public void setDueDate(Date dueDate) {
		this.dueDate = dueDate;
	}

	@Column(name = "pir_no", nullable = false, length = 10)
	public String getPirNo() {
		return this.pirNo;
	}

	public void setPirNo(String pirNo) {
		this.pirNo = pirNo;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "pir_due_date", length = 10)
	public Date getPirDueDate() {
		return this.pirDueDate;
	}

	public void setPirDueDate(Date pirDueDate) {
		this.pirDueDate = pirDueDate;
	}

	@Column(name = "division", nullable = false, length = 2)
	public String getDivision() {
		return this.division;
	}

	public void setDivision(String division) {
		this.division = division;
	}

	@Column(name = "material", nullable = false, length = 18)
	public String getMaterial() {
		return this.material;
	}

	public void setMaterial(String material) {
		this.material = material;
	}

	@Column(name = "design_no_fg", nullable = false, length = 40)
	public String getDesignNoFg() {
		return this.designNoFg;
	}

	public void setDesignNoFg(String designNoFg) {
		this.designNoFg = designNoFg;
	}

	@Column(name = "dyelot_lab", nullable = false, length = 50)
	public String getDyelotLab() {
		return this.dyelotLab;
	}

	public void setDyelotLab(String dyelotLab) {
		this.dyelotLab = dyelotLab;
	}

	@Column(name = "quantity", nullable = false, precision = 22, scale = 0)
	public Double getQuantity() {
		return this.quantity;
	}

	public void setQuantity(Double quantity) {
		this.quantity = quantity;
	}

	@Column(name = "uom", nullable = false, length = 6)
	public String getUom() {
		return this.uom;
	}

	public void setUom(String uom) {
		this.uom = uom;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "prod_create_date", length = 10)
	public Date getProdCreateDate() {
		return this.prodCreateDate;
	}

	public void setProdCreateDate(Date prodCreateDate) {
		this.prodCreateDate = prodCreateDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "plan_start_date", length = 10)
	public Date getPlanStartDate() {
		return this.planStartDate;
	}

	public void setPlanStartDate(Date planStartDate) {
		this.planStartDate = planStartDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "start_date", length = 10)
	public Date getStartDate() {
		return this.startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	@Column(name = "finish_goods", nullable = false, precision = 22, scale = 0)
	public Double getFinishGoods() {
		return this.finishGoods;
	}

	public void setFinishGoods(Double finishGoods) {
		this.finishGoods = finishGoods;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "last_posting_date", length = 10)
	public Date getLastPostingDate() {
		return this.lastPostingDate;
	}

	public void setLastPostingDate(Date lastPostingDate) {
		this.lastPostingDate = lastPostingDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "plan_finish_date", length = 10)
	public Date getPlanFinishDate() {
		return this.planFinishDate;
	}

	public void setPlanFinishDate(Date planFinishDate) {
		this.planFinishDate = planFinishDate;
	}

	@Column(name = "po_no", nullable = false, length = 40)
	public String getPoNo() {
		return this.poNo;
	}

	public void setPoNo(String poNo) {
		this.poNo = poNo;
	}

	@Column(name = "design_no_greige", nullable = false, length = 40)
	public String getDesignNoGreige() {
		return this.designNoGreige;
	}

	public void setDesignNoGreige(String designNoGreige) {
		this.designNoGreige = designNoGreige;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "greige_due_date", length = 10)
	public Date getGreigeDueDate() {
		return this.greigeDueDate;
	}

	public void setGreigeDueDate(Date greigeDueDate) {
		this.greigeDueDate = greigeDueDate;
	}

	@Column(name = "plan_greige", nullable = false, length = 20)
	public String getPlanGreige() {
		return this.planGreige;
	}

	public void setPlanGreige(String planGreige) {
		this.planGreige = planGreige;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "actual_greige", length = 10)
	public Date getActualGreige() {
		return this.actualGreige;
	}

	public void setActualGreige(Date actualGreige) {
		this.actualGreige = actualGreige;
	}

	@Column(name = "greige_remark", nullable = false, length = 50)
	public String getGreigeRemark() {
		return this.greigeRemark;
	}

	public void setGreigeRemark(String greigeRemark) {
		this.greigeRemark = greigeRemark;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "start_dye", length = 10)
	public Date getStartDye() {
		return this.startDye;
	}

	public void setStartDye(Date startDye) {
		this.startDye = startDye;
	}

	@Column(name = "dye_remark", nullable = false, length = 50)
	public String getDyeRemark() {
		return this.dyeRemark;
	}

	public void setDyeRemark(String dyeRemark) {
		this.dyeRemark = dyeRemark;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "submit_date", length = 10)
	public Date getSubmitDate() {
		return this.submitDate;
	}

	public void setSubmitDate(Date submitDate) {
		this.submitDate = submitDate;
	}

	@Column(name = "due_submit_date", nullable = false, length = 20)
	public String getDueSubmitDate() {
		return this.dueSubmitDate;
	}

	public void setDueSubmitDate(String dueSubmitDate) {
		this.dueSubmitDate = dueSubmitDate;
	}

	@Column(name = "status", nullable = false, length = 20)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "plan_due_date", length = 10)
	public Date getPlanDueDate() {
		return this.planDueDate;
	}

	public void setPlanDueDate(Date planDueDate) {
		this.planDueDate = planDueDate;
	}

	@Column(name = "current_operation", nullable = false, length = 30)
	public String getCurrentOperation() {
		return this.currentOperation;
	}

	public void setCurrentOperation(String currentOperation) {
		this.currentOperation = currentOperation;
	}

	@Column(name = "user_status", nullable = false, length = 30)
	public String getUserStatus() {
		return this.userStatus;
	}

	public void setUserStatus(String userStatus) {
		this.userStatus = userStatus;
	}

	@Column(name = "tot_produce_qty", nullable = false, precision = 22, scale = 0)
	public Double getTotProduceQty() {
		return this.totProduceQty;
	}

	public void setTotProduceQty(Double totProduceQty) {
		this.totProduceQty = totProduceQty;
	}

	@Column(name = "color_status", nullable = false, length = 20)
	public String getColorStatus() {
		return this.colorStatus;
	}

	public void setColorStatus(String colorStatus) {
		this.colorStatus = colorStatus;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "confirm_to_plan", length = 10)
	public Date getConfirmToPlan() {
		return this.confirmToPlan;
	}

	public void setConfirmToPlan(Date confirmToPlan) {
		this.confirmToPlan = confirmToPlan;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "confirm_to_sale", length = 10)
	public Date getConfirmToSale() {
		return this.confirmToSale;
	}

	public void setConfirmToSale(Date confirmToSale) {
		this.confirmToSale = confirmToSale;
	}

	@Column(name = "confirm_type", length = 1)
	public String getConfirmType() {
		return this.confirmType;
	}

	public void setConfirmType(String confirmType) {
		this.confirmType = confirmType;
	}

	@Column(name = "user_status_code", nullable = false, length = 20)
	public String getUserStatusCode() {
		return this.userStatusCode;
	}

	public void setUserStatusCode(String userStatusCode) {
		this.userStatusCode = userStatusCode;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "basic_start_date", length = 10)
	public Date getBasicStartDate() {
		return this.basicStartDate;
	}

	public void setBasicStartDate(Date basicStartDate) {
		this.basicStartDate = basicStartDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "basic_finish_date", length = 10)
	public Date getBasicFinishDate() {
		return this.basicFinishDate;
	}

	public void setBasicFinishDate(Date basicFinishDate) {
		this.basicFinishDate = basicFinishDate;
	}

	@Column(name = "overdue_status", nullable = false, length = 1)
	public String getOverdueStatus() {
		return this.overdueStatus;
	}

	public void setOverdueStatus(String overdueStatus) {
		this.overdueStatus = overdueStatus;
	}

	@Column(name = "reserve_dye_remark", length = 65535)
	public String getReserveDyeRemark() {
		return this.reserveDyeRemark;
	}

	public void setReserveDyeRemark(String reserveDyeRemark) {
		this.reserveDyeRemark = reserveDyeRemark;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "commonData")
	public Set<PlanGreige> getPlanGreiges() {
		return this.planGreiges;
	}

	public void setPlanGreiges(Set<PlanGreige> planGreiges) {
		this.planGreiges = planGreiges;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "commonData")
	public Set<RoutingData> getRoutingDatas() {
		return this.routingDatas;
	}

	public void setRoutingDatas(Set<RoutingData> routingDatas) {
		this.routingDatas = routingDatas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "commonData")
	public Set<ReserveItemGreige> getReserveItemGreiges() {
		return this.reserveItemGreiges;
	}

	public void setReserveItemGreiges(Set<ReserveItemGreige> reserveItemGreiges) {
		this.reserveItemGreiges = reserveItemGreiges;
	}

	
	//Customizing	
	public Vector retrieveRoutings() {
//		List<PlantColumn> columns = sortColumns(this.getPlant().getPlantColumns());
		Set<RoutingData> routingDatas = this.getRoutingDatas();
		RoutingData routing = null;
		if (routingDatas.iterator().hasNext()) {
			routing = (RoutingData)routingDatas.iterator().next();
		}
		return generateRouting(routing);
//		return generateRouting(columns, routing);
	}
	
//	public List<CommonData> getSaleProductions() {
//		System.out.println("getSaleProductions");
//		List<CommonData> dataList = new ArrayList();
//		Set<CommonData> saleProdData = this.getSaleData().getCommonDatas();
//		CommonData data = null;
//		while (saleProdData.iterator().hasNext()) {
//			data = (CommonData)saleProdData.iterator().next();
//			dataList.add(data);
//		}
//		return dataList;
//	}
	
	private List<PlantColumn> sortColumns(Set<PlantColumn> items) {
		List<PlantColumn> columns = new ArrayList();
		Iterator item = items.iterator();
		while (item.hasNext()) {
			PlantColumn column = (PlantColumn)item.next();
			columns.add(column);
		}
		Collections.sort(columns, new Comparator(){
            public int compare(Object o1, Object o2) {
            	PlantColumn p1 = (PlantColumn) o1;
            	PlantColumn p2 = (PlantColumn) o2;
               return String.valueOf(p1.getId().getColName()).compareToIgnoreCase(String.valueOf(p2.getId().getColName()));
            }
        });
		return columns;
	}
	
	private Vector generateRouting(RoutingData routing) {
		Vector routings = new Vector();
		if (routing!=null) {
			if (routing.getProcessName01() != null) {
				routings.addElement(getProcessLine(routing.getProcessName01(),routing.getProcess01()));
			}
			if (routing.getProcessName02() != null) {
				routings.addElement(getProcessLine(routing.getProcessName02(),routing.getProcess02()));
			}
			if (routing.getProcessName03() != null) {
				routings.addElement(getProcessLine(routing.getProcessName03(),routing.getProcess03()));
			}
			if (routing.getProcessName04() != null) {
				routings.addElement(getProcessLine(routing.getProcessName04(),routing.getProcess04()));
			}
			if (routing.getProcessName05() != null) {
				routings.addElement(getProcessLine(routing.getProcessName05(),routing.getProcess05()));
			}
			if (routing.getProcessName06() != null) {
				routings.addElement(getProcessLine(routing.getProcessName06(),routing.getProcess06()));
			}
			if (routing.getProcessName07() != null) {
				routings.addElement(getProcessLine(routing.getProcessName07(),routing.getProcess07()));
			}
			if (routing.getProcessName08() != null) {
				routings.addElement(getProcessLine(routing.getProcessName08(),routing.getProcess08()));
			}
			if (routing.getProcessName09() != null) {
				routings.addElement(getProcessLine(routing.getProcessName09(),routing.getProcess09()));
			}
			if (routing.getProcessName10() != null) {
				routings.addElement(getProcessLine(routing.getProcessName10(),routing.getProcess10()));
			}
			if (routing.getProcessName11() != null) {
				routings.addElement(getProcessLine(routing.getProcessName11(),routing.getProcess11()));
			}
			if (routing.getProcessName12() != null) {
				routings.addElement(getProcessLine(routing.getProcessName12(),routing.getProcess12()));
			}
			if (routing.getProcessName13() != null) {
				routings.addElement(getProcessLine(routing.getProcessName13(),routing.getProcess13()));
			}
			if (routing.getProcessName14() != null) {
				routings.addElement(getProcessLine(routing.getProcessName14(),routing.getProcess14()));
			}
			if (routing.getProcessName15() != null) {
				routings.addElement(getProcessLine(routing.getProcessName15(),routing.getProcess15()));
			}
			if (routing.getProcessName16() != null) {
				routings.addElement(getProcessLine(routing.getProcessName16(),routing.getProcess16()));
			}
			if (routing.getProcessName17() != null) {
				routings.addElement(getProcessLine(routing.getProcessName17(),routing.getProcess17()));
			}
			if (routing.getProcessName18() != null) {
				routings.addElement(getProcessLine(routing.getProcessName18(),routing.getProcess18()));
			}
			if (routing.getProcessName19() != null) {
				routings.addElement(getProcessLine(routing.getProcessName19(),routing.getProcess19()));
			}
			if (routing.getProcessName20() != null) {
				routings.addElement(getProcessLine(routing.getProcessName20(),routing.getProcess20()));
			}
		}
		return routings;
	}
	
	private HashMap getProcessLine(String name, String data) {
		HashMap process = new HashMap();
		process.put("name", name);
		process.put("data", data);
		return process;
	}
	
	private Vector generateRouting(List<PlantColumn> columns, RoutingData routing) {
		Vector routings = new Vector();
		for(int i=0;i<columns.size();i++) {
			PlantColumn column = columns.get(i);
			String processName = column.getColDescription();
			String processData = "";
			if (routing != null) {
				if (column.getId().getColName().equalsIgnoreCase("process01") && routing.getProcess01()!= null) {
					processData = routing.getProcess01();
				} else if (column.getId().getColName().equalsIgnoreCase("process02") && routing.getProcess02()!= null) {
					processData = routing.getProcess02();
				} else if (column.getId().getColName().equalsIgnoreCase("process03") && routing.getProcess03()!= null) {
					processData = routing.getProcess03();
				} else if (column.getId().getColName().equalsIgnoreCase("process04") && routing.getProcess04()!= null) {
					processData = routing.getProcess04();
				} else if (column.getId().getColName().equalsIgnoreCase("process05") && routing.getProcess05()!= null) {
					processData = routing.getProcess05();				
				} else if (column.getId().getColName().equalsIgnoreCase("process06") && routing.getProcess06()!= null) {
					processData = routing.getProcess06();			
				} else if (column.getId().getColName().equalsIgnoreCase("process07") && routing.getProcess07()!= null) {
					processData = routing.getProcess07();			
				} else if (column.getId().getColName().equalsIgnoreCase("process08") && routing.getProcess08()!= null) {
					processData = routing.getProcess08();			
				} else if (column.getId().getColName().equalsIgnoreCase("process09") && routing.getProcess09()!= null) {
					processData = routing.getProcess09();			
				} else if (column.getId().getColName().equalsIgnoreCase("process10") && routing.getProcess10()!= null) {
					processData = routing.getProcess10();		
				} else if (column.getId().getColName().equalsIgnoreCase("process11") && routing.getProcess01()!= null) {
					processData = routing.getProcess11();
				} else if (column.getId().getColName().equalsIgnoreCase("process12") && routing.getProcess12()!= null) {
					processData = routing.getProcess12();
				} else if (column.getId().getColName().equalsIgnoreCase("process13") && routing.getProcess13()!= null) {
					processData = routing.getProcess13();
				} else if (column.getId().getColName().equalsIgnoreCase("process14") && routing.getProcess14()!= null) {
					processData = routing.getProcess14();
				} else if (column.getId().getColName().equalsIgnoreCase("process15") && routing.getProcess15()!= null) {
					processData = routing.getProcess15();				
				} else if (column.getId().getColName().equalsIgnoreCase("process16") && routing.getProcess16()!= null) {
					processData = routing.getProcess16();			
				} else if (column.getId().getColName().equalsIgnoreCase("process17") && routing.getProcess17()!= null) {
					processData = routing.getProcess17();			
				} else if (column.getId().getColName().equalsIgnoreCase("process18") && routing.getProcess18()!= null) {
					processData = routing.getProcess18();			
				} else if (column.getId().getColName().equalsIgnoreCase("process19") && routing.getProcess19()!= null) {
					processData = routing.getProcess19();			
				} else if (column.getId().getColName().equalsIgnoreCase("process20") && routing.getProcess20()!= null) {
					processData = routing.getProcess20();		
				} 
			}
			HashMap process = new HashMap();
			process.put("name", processName);
			process.put("data", processData);
			routings.addElement(process);
		}
		return routings;
	}
}